package com.txcb.lib.base.utils;

import android.content.Context;

import com.txcb.lib.base.dialog.LoadingDialog;


/**
 * author Lambert on 2019/10/25
 */
public class LoadingDialogUtil {


    private static LoadingDialog loadingDialog;

    public static void showDialog(Context context, final String content, final boolean isTouch) {

        if (loadingDialog == null || !loadingDialog.isShowing()) {
            loadingDialog = new LoadingDialog(context, content);
            loadingDialog.setCanceledOnTouchOutside(isTouch);

            loadingDialog.show();
        } else {
            loadingDialog.setDialogContent(content);
        }
    }

    public static void showDialog(Context context, final String content) {
        showDialog(context,content,true);

    }


    /**
     * 关闭dialog
     */
    public static void closeDialog() {

        if (loadingDialog != null && loadingDialog.isShowing()) {
            loadingDialog.dismiss();
            loadingDialog = null;
        }

    }
}
